//index.js
//获取应用实例
const app = getApp()
const indexModel =require('../../modules/indexModel')
Page({
  data: {
  
  },
  async onLoad(){
    var res=await indexModel.getCat({cat:"日语"});
    console.log(res)
    var data=res.data.playlists;
 
    var musics=[];
    for(let i=0;i<data.length;i++){
      var obj={};
      obj.name=data[i].name;
      obj.author=data[i].creator.nickname;
      obj.id=data[i].id;
      obj.pic=data[i].coverImgUrl;
      musics.push(obj);
    }
    this.setData({
      musics,
    })
   
  },
  handleToggle(event){
    var id=event.detail
    wx.navigateTo({
      url:'/pages/detail/detail?id='+id,
    })
  }
})
